From eabeb6f5830f4c04dc814a1281d58bbbb8ecbc4a Mon Sep 17 00:00:00 2001 From: oliskoli Date: Mon, 20 Aug 2007 22:00:09 +0000 Subject: [PATCH] waypt: Add functions for speed and distance calculation. Add seperate project file for misc. GPS data parser functions. Add support for 'Swiss grid'. --- Makefile.in | 3 ++- defs.h | 14 ++++++++++++-- garmin_tables.c | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index f2ba350a9..c09e0117f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,7 +85,7 @@ LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \ csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o \ uuid.o formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \ xhtmlent.o inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ gbser.o \ - gbfile.o \ + gbfile.o parse.o \ $(PALM_DB) $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS) OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@ @@ -586,6 +586,7 @@ palmdoc.o: palmdoc.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \ jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ pdbfile.h +parse.o: parse.c defs.h config.h queue.h gbtypes.h jeeps/gpsmath.h pathaway.o: pathaway.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \ zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h csv_util.h strptime.h \ pdbfile.h diff --git a/defs.h b/defs.h index 11fbe25aa..0a29c5443 100644 --- a/defs.h +++ b/defs.h @@ -699,6 +699,10 @@ void waypt_disp(const waypoint *); void waypt_status_disp(int total_ct, int myct); double waypt_time(const waypoint *wpt); double waypt_speed(const waypoint *A, const waypoint *B); +double waypt_speed_ex(const waypoint *A, const waypoint *B); +double waypt_course(const waypoint *A, const waypoint *B); +double waypt_distance(const waypoint *A, const waypoint *B); +double waypt_distance_ex(const waypoint *A, const waypoint *B); NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2); void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3); @@ -892,17 +896,23 @@ typedef enum { grid_lat_lon_dmm = 1, grid_lat_lon_dms = 2, grid_bng = 3, - grid_utm = 4 + grid_utm = 4, + grid_swiss = 5 } grid_type; #define GRID_INDEX_MIN grid_lat_lon_ddd -#define GRID_INDEX_MAX grid_utm +#define GRID_INDEX_MAX grid_swiss #define DATUM_OSGB36 86 #define DATUM_WGS84 118 +/* + * From parse.c + */ int parse_coordinates(const char *str, int datum, const grid_type grid, double *latitude, double *longitude, const char *module); +int parse_distance(const char *str, double *val, double scale, const char *module); +int parse_speed(const char *str, double *val, const double scale, const char *module); /* * From util_crc.c diff --git a/garmin_tables.c b/garmin_tables.c index 3bae4469c..4dadeae70 100644 --- a/garmin_tables.c +++ b/garmin_tables.c @@ -617,6 +617,7 @@ grid_mapping_t gt_mps_grid_names[] = { "dms", "Lat/Lon hddd*mm'ss.s\"", grid_lat_lon_dms }, { "bng", "British National Grid", grid_bng }, { "utm", "UTM", grid_utm }, + { "swiss", "Swiss grid", grid_swiss }, { NULL, NULL, 0 } }; -- 2.30.2